//
//  Car.m
//  cityCar
//
//  Created by 刘伟 on 14-10-28.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "Car.h"

@implementation Car
- (void)dealloc
{
    [_Id   release];
    [_name release];
    [_logo release];
    [_priceRange release];
    [super dealloc];
}

#pragma mark - NSCoding 协议方法
- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super init];
    if (self) {
        self.Id = [aDecoder decodeObjectForKey:@"id"];
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.logo = [aDecoder decodeObjectForKey:@"photo"];
        self.priceRange = [aDecoder decodeObjectForKey:@"priceRange"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeObject:self.Id forKey:@"id"];
    [aCoder encodeObject:self.logo forKey:@"photo"];
    [aCoder encodeObject:self.priceRange forKey:@"priceRange"];
}


- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    // 系统的纠错方法,当key值不在类的属性列表的时候,就会调用
    
    
    if ([key isEqualToString:@"id"]) {
        self.Id = value;
    }
    if ([key isEqualToString:@"photo"]) {
        self.logo = value;
    }
    //    else {
    //
    ////        NSLog(@"没找到'%@'KEY", key);
    //    }
}

// 取值的纠错方法
- (id)valueForUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"id"]) {
        return self.Id;
    }
    if ([key isEqualToString:@"photo"]) {
        return self.logo;
    }
    return nil;
}



@end
